/*
 * @Descripttion: 
 * @version: 
 * @Author: mmzhang
 * @Date: 2021-07-23 11:03:01
 * @LastEditTime: 2022-05-18 18:49:56
 */

import table from '@/components/dt/table/render.js'
let _this = null;

const sendThis = (vm) => {
  _this = vm;
};
export default {
  sendThis,
  columns: [{
    title: '区域/子公司',
    field: 'orgEndName',
    minWidth: 250,
    fixed: 'left',
    treeNode: true,
    slots: {
      default: (params, h) => {
        return table.cell.text(h, {
          value: params.row.orgEndName
        })
      }
    }
  },
  {
    title: '开发商简称',
    field: 'developerAbbreviation',
    minWidth: 180,
    slots: {
      default: (params, h) => {
        return [h('div', params.row.developerAbbreviation)]
      }
    }
  },
  {
    title: '认购',
    field: 'subscribe',
    minWidth: 180,
    slots: {
      default: (params, h) => {
        if (params.row.subscribe != '0') {
          return table.cell.btn(_this, h, {
            title: params.row.subscribe,
            event: 'linkOrderSummaryFun',
            data: [0, params.row, 0],
            type:'number',
            fixed: 0
          })
        } else {
          return [h('div', params.row.subscribe)]
        }
      }
    }
  },
  {
    title: '签约',
    field: 'signUp',
    minWidth: 180,
    slots: {
      default: (params, h) => {
        if (params.row.signUp != '0') {
          return table.cell.btn(_this, h, {
            title: params.row.signUp,
            event: 'linkOrderSummaryFun',
            data: [1, params.row, 2],
            type:'number',
            fixed: 0
          })
        } else {
          return [h('div', params.row.signUp)]
        }
      }
    }
  },
  {
    title: '签约金额（元）',
    field: 'signUpAmount',
    minWidth: 150,
    slots: {
      default: (params, h) => {
        if (params.row.signUp != '0') {
          return table.cell.btn(_this, h, {
            title: params.row.signUpAmount,
            event: 'linkOrderSummaryFun',
            data: [1, params.row, 2],
            type:'number'
          })
        } else {
          return [h('div', params.row.signUpAmount)]
        }
      }
    }
  },
  {
    title: '签约率（%）',
    field: 'signUpRate',
    minWidth: 130,
    slots: {
      default: (params, h) => {
        return [h('div', ((params.row.signUpRate * 10000) / 100).toFixed(2))]
      }
    }
  },
  {
    title: '退签',
    field: 'withdraw',
    minWidth: 180,
    slots: {
      default: (params, h) => {
        if (params.row.withdraw != '0') {
          return table.cell.btn(_this, h, {
            title: params.row.withdraw,
            event: 'linkOrderSummaryFun',
            data: [1, params.row, 3],
            type:'number',
            fixed: 0
          })
        } else {
          return [h('div', params.row.withdraw)]
        }
      }
    }
  },
  {
    title: '退签金额（元）',
    field: 'withdrawAmount',
    minWidth: 150,
    slots: {
      default: (params, h) => {
        if (params.row.withdraw != '0') {
          return table.cell.btn(_this, h, {
            title: params.row.withdrawAmount,
            event: 'linkOrderSummaryFun',
            data: [1, params.row, 3],
            type:'number'
          })
        } else {
          return [h('div', params.row.withdrawAmount)]
        }
      }
    }
  },
  {
    title: '退签率（%）',
    field: 'withdrawRate',
    minWidth: 130,
    slots: {
      default: (params, h) => {
        return [h('div', ((params.row.withdrawRate * 10000) / 100).toFixed(2))]
      }
    }
  },
  {
    title: '签约调整金额（元）',
    field: 'signUpAdjustmentAmount',
    minWidth: 180,
    cell:{
      value:(info)=> info.signUpAdjustmentAmount,
      text:{
        type: 'number',
      }
    }
  },
  {
    title: '签约净值',
    field: 'signUpNetWorth',
    minWidth: 180,
    cell:{
      value:(info)=> info.signUpNetWorth,
      text:{
        type: 'number',
        fixed: 0
      }
    }
  },
  {
    title: '签约净值金额（元）',
    field: 'signUpNetWorthAmount',
    minWidth: 170,
    slots: {
      default: (params, h) => {
        return [h('div', _this.$tool.formatterMoney(params.row
          .signUpNetWorthAmount))]
      }
    }
  },
  {
    title: '签约净值率（%）',
    field: 'signUpNetWorthRate',
    minWidth: 150,
    slots: {
      default: (params, h) => {
        return [h('div', ((params.row.signUpNetWorthRate * 10000) / 100).toFixed(
          2))]
      }
    }
  },
  {
    title: '规定日期内签约',
    field: 'setTimeSignUp',
    minWidth: 180,
    cell:{
      value:(info)=> info.setTimeSignUp,
      text:{
        type: 'number',
        fixed: 0
      }
    }
  },
  {
    title: '延期签约',
    field: 'postponeSignUp',
    minWidth: 130,
    cell:{
      value:(info)=> info.postponeSignUp,
      text:{
        type: 'number',
        fixed: 0
      }
    }
  }],
}